#!/usr/bin/php
<?PHP
###################################
#                                 #
# CA Automatic Turbo Mode         #
# Copyright 2017, Andrew Zawadzki #
#                                 #
###################################

require_once("/usr/local/emhttp/plugins/ca.turbo/include/helpers.php");
require_once("/usr/local/emhttp/plugins/ca.turbo/include/paths.php");

$settings = getPluginSettings();
if ($settings['enabled'] == "yes") {
  logger("Starting CA Auto Turbo Mode");
  $descriptorspec = array(
    0 => array("pipe", "r"),  // stdin is a pipe that the child will read from
    1 => array("pipe", "w"),  // stdout is a pipe that the child will write to
    2 => array("file", "/tmp/error-output.txt", "a") // stderr is a file to write to
  );
  proc_open("/usr/local/emhttp/plugins/ca.turbo/scripts/auto_turbo.php",$descriptorspec,$pipes);
}
?>